<!DOCTYPE html>
<html>
<head>
    <title></title>
    #parse("sys/header.html")
    <style>
        .upload-list {
            display: inline-block;
            width: 60px;
            height: 60px;
            text-align: center;
            line-height: 60px;
            border: 1px solid transparent;
            border-radius: 4px;
            overflow: hidden;
            background: #fff;
            position: relative;
            box-shadow: 0 1px 1px rgba(0, 0, 0, .2);
            margin-right: 4px;
        }

        .upload-list img {
            width: 100%;
            height: 100%;
        }

        .upload-list-cover {
            display: none;
            position: absolute;
            top: 0;
            bottom: 0;
            left: 0;
            right: 0;
            background: rgba(0, 0, 0, .6);
        }

        .upload-list:hover .upload-list-cover {
            display: block;
        }

        .upload-list-cover i {
            color: #fff;
            font-size: 20px;
            cursor: pointer;
            margin: 0 2px;
        }
    </style>
</head>
<body>
<div id="rrapp" v-cloak>
    <div v-show="showList">
        <Row :gutter="16">
            <div class="search-group">
                <i-col span="4">
                    <i-select v-model="q.storeId" placeholder="门店" filterable label-in-value>
                        <i-option v-for="store in stores" :value="store.id"
                                  :key="store.id">{{store.storeName}}
                        </i-option>
                    </i-select>
                </i-col>
                <i-col span="4">
                    <i-input v-model="q.goodsName" @on-enter="query" placeholder="名称"/>
                </i-col>
                <i-col span="4">
                    <i-input v-model="q.goodsSn" @on-enter="query" placeholder="商品编码"/>
                </i-col>
                <i-col span="4">
                    <i-input v-model="q.productSn" @on-enter="query" placeholder="规格编码"/>
                </i-col>
                <i-button @click="query">查询</i-button>
                <i-button @click="reloadSearch">重置</i-button>
            </div>
            <div class="buttons-group">
                #if($shiro.hasPermission("productstorerela:upload"))
                <i-col style="display: inline-grid;">
                    <Upload :show-upload-list="false" :on-success="uploadExcelSuccess" :on-error="uploadExcelError"
                            action="../goods/upload">
                        <i-button type="ghost" icon="ios-cloud-upload-outline">导入</i-button>
                    </Upload>
                </i-col>
                #end
                #if($shiro.hasPermission("productstorerela:save"))
                <i-button type="info" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</i-button>
                #end
                #if($shiro.hasPermission("productstorerela:update"))
                <i-button type="warning" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</i-button>
                #end
                #if($shiro.hasPermission("productstorerela:delete"))
                <i-button type="error" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</i-button>
                #end
            </div>
        </Row>
        <table id="jqGrid"></table>
        <div id="jqGridPager"></div>
    </div>

    <Card v-show="!showList">
        <p slot="title">{{title}}</p>
        <i-form ref="formValidate" :model="productStoreRela" :rules="ruleValidate" :label-width="80">
            <Form-item label="门店" prop="storeId">
                <i-select v-model="productStoreRela.storeId" placeholder="门店" filterable
                          label-in-value>
                    <i-option v-for="store in stores" :value="store.id"
                              :key="store.id">{{store.storeName}}
                    </i-option>
                </i-select>
            </Form-item>

            <Form-item label="商品" prop="goodsId">
                <i-select v-model="productStoreRela.goodsId" filterable @on-change="changeGoods" label-in-value>
                    <i-option v-for="goods in goodss" :value="goods.id" :key="goods.id">{{goods.name}}</i-option>
                </i-select>
            </Form-item>
            <Form-item label="规格" prop="productId">
                <i-select v-model="productStoreRela.productId" filterable>
                    <i-option v-for="product in products" :value="product.id"
                              :key="product.id">{{product.goodsSpecificationNameValue}}
                    </i-option>
                </i-select>
            </Form-item>
            <!---->
            <!--<Form-item label="商品名称" prop="goodsName" v-show="productStoreRela && productStoreRela.id">-->
            <!--<i-input v-model="productStoreRela.goodsName" placeholder="商品名称"/>-->
            <!--</Form-item>-->
            <!--<Form-item label="规格编码" prop="productSn">-->
            <!--<i-input v-model="productStoreRela.productSn" placeholder="规格编码"/>-->
            <!--</Form-item>-->
            <Form-item label="库存" prop="goodsNumber">
                <Input-number :min="0" :step="1" v-model="productStoreRela.stockNum" placeholder="总库存"
                              style="width: 188px;"/>
            </Form-item>
            <Form-item label="零售价格" prop="retailPrice">
                <Input-number :min="0" :step="1" v-model="productStoreRela.retailPrice" placeholder="零售价格"
                              style="width: 188px;"/>
            </Form-item>
            <Form-item label="市场价" prop="marketPrice">
                <Input-number :min="0" :step="1" v-model="productStoreRela.marketPrice" placeholder="市场价"
                              style="width: 188px;"/>
            </Form-item>
            <Form-item label="库存价格" prop="stockPrice">
                <Input-number :min="0" :step="1" v-model="productStoreRela.stockPrice" placeholder="库存价格"
                              style="width: 188px;"/>
            </Form-item>
            <!--<Form-item label="销售量" prop="sellVolume">-->
                <!--<Input-number :min="0" :step="1" v-model="productStoreRela.sellVolume" placeholder="销售量"-->
                              <!--style="width: 188px;"/>-->
            <!--</Form-item>-->
        </i-form>
        <div style="padding-left: 20px">
            <i-button type="primary" @click="handleSubmit('formValidate')">提交</i-button>
            <i-button type="warning" @click="reload" style="margin-left: 8px"/>
            返回</i-button>
            <i-button type="ghost" @click="handleReset('formValidate')" style="margin-left: 8px">重置</i-button>
        </div>
    </Card>
</div>

<!-- 选择类型 -->
<div id="categoryLayer" style="display: none;padding:10px;">
    <ul id="categoryTree" class="ztree"></ul>
</div>

<script src="${rc.contextPath}/js/shop/storeProductStock.js?_${date.systemTime}"></script>
</body>
</html>